﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace UIT_CV_Management
{
    public class HocHam
    {
        public String MaTenHocHam;
        public String TenHocHam;

        public HocHam(String _MaTenHocHam)
        {
            QueryResult result = Database.shareDatabase.Query("SELECT * FROM HocHam " +
                "WHERE MaTenHocHam = '" + _MaTenHocHam + "'");
            if (result.ReturnCode == 200)
            {
                DataRow row = result.Table.Rows[0];
                MaTenHocHam = _MaTenHocHam;
                TenHocHam = row["TenHocHam"].ToString();
                
            }
            else
                MessageBox.Show(result.Error);
        }

        public static String getTenHocHam(String _MaTenHocHam)
        {
            QueryResult result = Database.shareDatabase.Query("SELECT * FROM HocHam " +
                "WHERE MaTenHocHam = '" + _MaTenHocHam + "'");
            if (result.ReturnCode == 200)
            {
                DataRow row = result.Table.Rows[0];
                return row["TenHocHam"].ToString();
            }
            else
                return null;
        }
    }
}
